package com.ycz.master.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ycz.master.pojo.Loan;
import com.ycz.master.service.LoanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * author zyc
 * Created on 2021/10/24 15:33
 */
@Controller
@RequestMapping("/loan")
public class LoanController {
    @Autowired
    private LoanService service;

    //风控查询
    @RequestMapping("/findall")
    @ResponseBody
    public PageInfo findall(@RequestParam(value = "pn",defaultValue = "1")Integer pn) {
        PageHelper.startPage(pn,8);

        List<Loan> loans = service.selectAll();
        System.out.println(loans);
        PageInfo page=new PageInfo(loans,5);
        System.out.println(page);
        return page;
    }

    //风控查询
    @RequestMapping("/findselect")
    @ResponseBody
    public List<Loan> findall(@RequestParam String status) {
      return service.selectByStatus(status);

    }
}
